// packageB/pages/package/topic_manage/add_manage/add.js
const mybehavior = require("../../../../../behaviors/requests")
Page({

  /**
   * 页面的初始数据
   */
  behaviors: [mybehavior],
  data: {
    activeNames: [],
    sqd_total:0,
    sqd_arr:[],
    total1:0,
    total:0,
    list1:""
  },
  onChange(event) {
    this.setData({
      activeNames: event.detail,
    });
  },

  goToOutdoor(e){
    console.log(e.currentTarget.dataset.row_data);
    let key  = e.currentTarget.dataset.row_data
    wx.navigateTo({
      url: '/packageA/pages/package/nav_outdoor_records/nav_outdoor_manage/outdoor_manage?id=='+ key,
    })
  },
  // 工装容器数据
  getDataList1() {
    let self = this;
    let url = "https://logisticsengineering.gree.com/container_manage_api/container_manage/get_current_task"
    let data = {
      page_size: 9999,
      page: 1,
    }
    this.post(url, data).then(res => {
      if (res.code == 20000) {
        let show_list = res.data.results
        // console.log(show_list);
        for (let i in show_list) {
          show_list[i].submit_time = this.GMTToStr(show_list[i].submit_time)
          let live_record_length = show_list[i].live_record.length
          show_list[i].time1 = this.GMTToStr(show_list[i].live_record[live_record_length - 1].time)
       
        }

        self.setData({
          list1: show_list,
          total1: res.data.total,
         


        })
        // console.log("x", self.data.current_status1, self.data.current_status2, self.data.current_btn,);


      } else {
        // wx.showToast({
        //   title: res.msg,
        //   icon: "error"
        // })
        self.setData({
          list1: [],
        })
      }
    }).catch(err => {
      self.setData({
        list1: [],
      })
      // wx.showToast({
      //   title: err.msg,
      //   icon: 'error'
      // })
    })
  },
  goHandle1(e){
    // console.log(e.currentTarget.dataset.row_data);
    let key  = e.currentTarget.dataset.row_data
    wx.navigateTo({
      url: '/pages/wuliurongqiguanli/nav_handling/handling?id='+ key,
    })
  },
  routeJump(e) {
    // console.log(e.currentTarget.dataset.row_data);
    let key = e.currentTarget.dataset.row_data
    wx.navigateTo({
      url: key,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getDataList1()
    this.setData({
      total:this.data.sqd_total + this.data.total1
    })
    console.log("xxxx",this.data.total);
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})